<extend name="Layout::news"/>
<block name="content">
    <div class="layout-content">

        <div class="page-title">公告管理</div>

        <div class="content-top">
            <ul class="top-nav">
                <li class="active"><span>添加信息</span></li>
            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
        <!--content-main start-->
        <div class="container-fluid content-main">
            <div class="row">
                <div class="col-md-12">
                    <div id="tsk" class="ui-tips bg-info" style="display:none">
                        <span class="icon glyphicon glyphicon-info-sign"></span> <span
                            id="ts">提示信息提示信息提示信息提示信息提示信息提示信息。</span>
                    </div>

                    <form class=" form-horizontal"  action="{:U('News/doUpdate')}" method="post" enctype="multipart/form-data">
                        <input type="hidden" value="{$list['id']}" name="id">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标题</label>
                            <div class="col-sm-5">
                                <input type="text" value="{$list['title']}" name="title" class="form-control js-title"/>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">作者</label>
                            <div class="col-sm-5">
                                <input type="text" value="{$list['editor']}" name="editor" class="form-control js-editor"/>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标签</label>
                            <div class="col-sm-5">
                                <select class="form-control js-cate" name="news_cate">
                                    <foreach name="cates" item="cate">
                                        <option data-cate="{$cate.id}" value="{$cate.id}">{$cate.name}</option>
                                    </foreach>
                                </select>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">摘要</label>
                            <div class="col-sm-2">
                                <textarea maxlength="200" placeholder="最多两百个字符" style="width:400px; "  name="abstract" >{$list['abstract']}</textarea>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文章内容</label>
                            <div class="col-sm-5">
                                <script type="text/javascript" src="__PUBLIC__/static/utf8-php/ueditor.config.js"></script>
                                <script type="text/javascript" src="__PUBLIC__/static/utf8-php/ueditor.all.js"></script>
                                <script id="content" name="content"  value= "{$list['content']}"  type="text/plain" style="width:400px;height:100px;"></script>

                                <script type="text/javascript">
                                    window.UEDITOR_HOME_URL = "__PUBLIC__/static/utf8-php/";
                                </script>
                                <script type="text/javascript">
                                    var ue = UE.getEditor('content');
                                    ue.addListener("ready", function () {
                                        // editor准备好之后才可以使用
                                        ue.setContent("{$list['content']}");
                                    });
                                </script>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">展位图片</label>
                            <div class="col-sm-2">
                               <img src="__PUBLIC__/upload/{$list['layout']}"  width="120px" height="120px">
                                <input type="file" name="pic">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否置顶</label>
                            <div class="col-sm-2">
                                是<input type="radio" name="stick"  data-stick="10"   value="10"  >
                                否<input type="radio" name="stick"  data-stick="30"  value="30" >
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否显示</label>
                            <div class="col-sm-2">
                                是<input type="radio" name="status"  data-status="10"   value="10" >
                                否<input type="radio" name="status" data-status="30" value="30">
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-8">
                                <button  style="margin-left: 90px;width: 150px" type="submit"
                                        class="btn btn-default">保存
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--content-main end-->
    </div>
    <script>
        $('option[data-cate={$list["news_cate"]}]').attr("selected", true);
        $('input[data-stick={$list["stick"]}]').attr("checked", "checked");
        $('input[data-status={$list["status"]}]').attr("checked", "checked");

    </script>
</block>
